<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('发票/收据修改未上传页面')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <a class="btn btn-info btn-outline visible-xs-block" href="#" onclick="$.modal.closeTab()">返回</a>
    <form class="form-horizontal m" id="form-engineers-edit" th:object="${proRepairEngineers}">
        <input id="mPid" name="mPid" th:field="*{mPid}" type="hidden">
        <!--<div class="form-group">
            <label class="col-sm-3 control-label">维修项目名称：</label>
            <div class="col-sm-8">
                <input name="mMpname" th:field="*{mMpname}" class="form-control" type="text">
            </div>
        </div>-->
        <!--            <div class="form-group">    -->
        <!--                <label class="col-sm-3 control-label">维修联系单/报价单上传：</label>-->
        <!--                <div class="col-sm-8">-->
        <!--                    <input name="mPriceSheet" th:field="*{mPriceSheet}" class="form-control" type="text">-->
        <!--                </div>-->
        <!--            </div>-->
        <!--<div class="form-group">
            <label class="col-sm-3 control-label">维修项目状态：</label>
            <div class="col-sm-8">
                <select name="mStatus" th:with="type=${@dict.getType('maintenance_project_status')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{mStatus}">
                </select>
                &lt;!&ndash;                    <div class="radio-box">&ndash;&gt;
                &lt;!&ndash;                        <input type="radio" name="mStatus" value="">&ndash;&gt;
                &lt;!&ndash;                        <label th:for="mStatus" th:text="未知"></label>&ndash;&gt;
                &lt;!&ndash;                    </div>&ndash;&gt;
                &lt;!&ndash;                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>&ndash;&gt;
            </div>
        </div>-->
                    <div class="form-group">
                        <label class="col-sm-3 control-label">维修发票/收据上传：</label>
                        <div class="col-sm-8">
                            <input id="mReceipt" name="file1" th:field="*{mReceipt}" class="form-control" type="file">
                        </div>
                    </div>
        <!--<div class="form-group">
            <label class="col-sm-3 control-label">维修费支付状态：</label>
            <div class="col-sm-8">
                <select name="mCoststatus" th:with="type=${@dict.getType('maintenance_coststatus')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{mCoststatus}">
                </select>
                &lt;!&ndash;                    <div class="radio-box">&ndash;&gt;
                &lt;!&ndash;                        <input type="radio" name="mCoststatus" value="">&ndash;&gt;
                &lt;!&ndash;                        <label th:for="mCoststatus" th:text="未知"></label>&ndash;&gt;
                &lt;!&ndash;                    </div>&ndash;&gt;
                &lt;!&ndash;                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>&ndash;&gt;
            </div>
        </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">水/电派工单上传：</label>
                        <div class="col-sm-8">
                            <input name="mJobOrder" th:field="*{mJobOrder}" class="form-control" type="text">
                        </div>
                    </div>-->
        <div class="form-group">
            <label class="col-sm-3 control-label">创建时间：</label>
            <div class="col-sm-8">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input id="mDate" name="mDate" th:value="${#dates.format(proRepairEngineers.mDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                </div>
            </div>
        </div>
        <div class="form-group" hidden>
            <label class="col-sm-3 control-label">外键id：</label>
            <div class="col-sm-8">
                <input id="mtId" name="mtId" th:field="*{mtId}" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script type="text/javascript">
    var prefix = ctx + "ruoyi/engineers";
    $("#form-engineers-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            uploadFile();
            //$.operate.save(prefix + "/edit", $('#form-engineers-edit').serialize());
        }
    }


    function uploadFile() {
        var formData = new FormData();
        if($('#mReceipt')[0].files[0]!=null)
        {
            formData.append('mPid', $("#mPid").val());
            formData.append('file1', $('#mReceipt')[0].files[0]);
            formData.append('mDate', $("#mDate").val());
            formData.append('mtId', $("#mtId").val());
            $.ajax({
                url: prefix + "/editmReceipt",
                type: 'post',
                cache: false,
                data: formData,
                processData: false,
                contentType: false,
                dataType: "json",
                success: function (result) {
                    $.operate.successCallback(result);
                }
            });
        }else{
            $.modal.alertWarning("请先选择文件路径");
            return false;
        }
    }

    $("input[name='mDate']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>
</body>
</html>